Skip to content

fix(send): read text from stdin, never through shell quoting - #9

Merged
logickoder merged 3 commits into
mainfrom
fix/send-stdin
Nov 23, 2026
Merged

logickoder merged 3 commits into
mainfrom
fix/send-stdin

Conversation

@logickoder

Copy link
Copy Markdown
Owner

Closes #8.

Change

Agents sent with agent-bridge send ... "<text>". Inside double quotes the shell runs backticks and $(...), so quoted issue text or a peer's message ran on the sender's machine.

  • send <to> - reads the text from stdin. It refuses a terminal stdin and blank text, and keeps leading indentation (the schema used to trim it).
  • Reply hints use a quoted heredoc with a random end marker, made per hint on the receiving machine. A fixed marker can be planted in a message to end the heredoc early and run what follows.
  • Join output shows no marker. agent-bridge marker prints a fresh one for new sends, so agents never make one up.
  • opencode's tool passes the text on stdin.
  • Bypass-mode guard: strips heredoc bodies before looking for agent-bridge join, so a send that mentions it is no longer denied. Unclosed heredocs fail closed.
  • Site: diagram, README graphic, beats card and demo video show the heredoc form. Also fixes a sideways scroll on the live page from 768px to about 1000px.

MCP-only sends were ruled out: shell sends carry the session id the daemon uses to check --as.

Verified

  • pnpm check: 332 unit, 96 e2e. New e2e tests run sends through a real sh -c with backticks, $(...), quotes, a planted fixed marker, indentation, a terminal stdin, and agent-bridge marker.
  • Live, in tmux: Claude Code, Antigravity 1.5.14 and opencode 2.3.2 sent a file holding planted commands and planted AB_END/EOF lines. Bodies arrived byte-identical; inline replies used their hint's random marker; no planted command ran. Logged in docs/live-tests.md.
  • Site at 320 to 1440px: no sideways scroll, no clipped code, no label over a box. Both themes for the SVG.

Merging deploys the site.

The bypass-mode guard matched `agent-bridge join` anywhere in a Bash
command, so a send whose text mentioned it was denied. It now strips
heredoc bodies and checks every other line. An unclosed heredoc stays
in, so the guard fails closed.
Agents sent with `agent-bridge send ... "<text>"`. Inside double quotes
the shell runs backticks and $(...), so quoted issue text or a peer's
message ran on the sender's machine.

- `send <to> -` reads the text from stdin. It refuses a terminal stdin
  and blank text, and keeps leading indentation.
- Reply hints use a quoted heredoc with a random end marker per hint. A
  fixed marker could be planted to end the heredoc early. Join output
  shows no marker; `agent-bridge marker` prints a fresh one.
- opencode's tool passes the text on stdin.
- e2e tests run sends through a real `sh -c`.

Closes #8
The diagram, README graphic, beats card and demo video now send with a
quoted heredoc and a random end marker, matching the agent hints.

The diagram's right column held a fixed 132px wire plus a box, wider
than the column from 768px to about 1000px, so the page scrolled
sideways. The wire column now shrinks and its label wraps.
@logickoder
logickoder merged commit 50150f2 into main Nov 23, 2026
3 checks passed
@logickoder
logickoder deleted the fix/send-stdin branch November 23, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

send: reply text is expanded by the shell, so quoted backticks run as commands

1 participant